from django.urls import path
from . import admin

app_name = 'knowledge'

urlpatterns = [
    # 知识库管理页面路由
    path('', admin.knowledge_index, name='index'),
    path('create-collection/', admin.create_collection, name='create_collection'),
    path('collection/<str:collection_name>/', admin.collection_detail, name='collection_detail'),
    path('collection/<str:collection_name>/add-document/', admin.add_document, name='add_document'),
    path('collection/<str:collection_name>/document/<str:document_id>/', admin.view_document, name='view_document'),
    path('collection/<str:collection_name>/document/<str:document_id>/edit/', admin.edit_document, name='edit_document'),
    path('collection/<str:collection_name>/document/<str:document_id>/delete/', admin.delete_document, name='delete_document'),
    path('collection/<str:collection_name>/delete/', admin.delete_collection, name='delete_collection'),
    path('search/', admin.search_knowledge, name='search'),
    path('collection/<str:collection_name>/search/', admin.search_knowledge, name='search_collection'),
    path('ai-search/', admin.ai_search_knowledge, name='ai_search'),
    path('collection/<str:collection_name>/ai-search/', admin.ai_search_knowledge, name='ai_search_collection'),

    # API接口路由
    path('api/collections/', admin.api_collections, name='api_collections'),
    path('api/collection/<str:collection_name>/documents/', admin.api_documents, name='api_documents'),
    path('api/collection/<str:collection_name>/document/<str:document_id>/', admin.api_document_detail, name='api_document_detail'),
    path('api/search/', admin.api_search, name='api_search'),
    path('api/collection/<str:collection_name>/search/', admin.api_search, name='api_search_collection'),
]